<!DOCTYPE html>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<title></title>
<html>
<head>
<style type="text/css">
	*{
		margin: 0;
		padding: 0;
	}
	html,body{
		margin: 0;
		padding: 0;
		font-family:'Microsoft Yahei','Hiragino Sans GB', 'Helvetica Neue', 'Luxi Sans', 'DejaVu Sans', Tahoma, STHeiti, Arial, Helvetica, sans-serif;
		background-color: floralwhite;
	}
	.wrap {
		height: 30rem;
		width: 100%; 
		position: absolute;
	}
	.content { 
		margin:1rem auto 0; 
		width:92%; 
		height:13.5rem;  
		}  
	@media only screen and (min-width: 500px){
		.content { 
		margin:0 auto; 
		width:92%; 
		height:18rem;  
		}
	}
	
</style>
</head>

<body> 
	 <div class="wrap">
	 	<div class="content">
	 	<div id="youkuplayer" style="width:100%;height:100%"></div>
	 	</div>
	 </div>
</body>

<script type="text/javascript" src="../js/Base64.min.js" ></script>
<script type="text/javascript" src="../js/common.js"></script>
<script type="text/javascript" src="../js/jquery-1.11.0.js"></script>
<script>
  (function ($) {
  $.getUrlParam = function (name) {
   var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
   var r = window.location.search.substr(1).match(reg);
   if (r != null) return unescape(r[2]); return null;
  }
 })(jQuery);
</script>


<script type="text/javascript" src="//player.youku.com/jsapi"></script> 
<script>
	function setVideoInfo (proName, videoCode, videoSource, type) { 
		var titleValue;
		if(type==2){ 
			titleValue="录音";
		}else if(type==3){ 
			titleValue="视频";
		} 	
		$("title").html(titleValue);
//		var $ph = $('<p></p >');
		var $pf = $('<p></p >');
//		$ph.css({
//			"background-color": "#BFC7D3",
//			"font-size": "0.7rem",
//			"text-align": "center",
//			"height" : "4rem",
//			"line-height": "4rem"
//		}); 
//		$ph.text(proName);
		$pf.css({ 
			"font-size": "1rem", 
			"height" : "4rem",
			"line-height": "4rem"
		});
		$pf.text(titleValue+"密码:"+videoCode);
		
		
		
		var player = new YKU.Player('youkuplayer',{
						styleid: '0',
						client_id: 'YOUR YOUKUOPENAPI CLIENT_ID',
						vid: videoSource,
						newPlayer: true
					}); 
					
//		$(".content").append($ph); 
		$(".content").append($pf); 
}
</script>





<script>   
	$(window).load(function(){  
		
		var prodId=$.getUrlParam('prodId'); 
		var prodCode=$.getUrlParam('prodId'); 
		var userId=$.getUrlParam('userId');
		var type=$.getUrlParam('type');
		var prodName=$.getUrlParam('prodName'); 
		var str="{'prodId':'"+prodCode+"','type':'"+type+"'}"; 
		str = Base64.encode(str);
		var interFace='';  
				if(type==2){ //2 录音
					interFace="get_product_train";
				}else if(type==3){  //3 视频
					interFace="get_product_train";
				}
			jQuery(function(){
					jQuery.ajax({
						url:tuijian_material,
						type:"post",
						dataType:"text",
						data:{commonURL:tuijian_material,"opName":interFace,'param':str,'osFlag':'5'},
						async:false,
						success:function(serverinfo){ 
							var Data=decodeURI(Base64.decode(serverinfo)); 
							Data=JSON.parse(Data); 
							if (Data.retCode == 0) { 
								if(Data.content){
									if(Data.content.length!=0){
										setVideoInfo(prodName, Data.content[0].value, Data.content[0].title, type);
									}else{
										$(".content").html('后台小伙伴暂未上传')
										$(".content").css({"text-align":"center","line-height":"4rem","color":"#666","font-size":"0.5rem"});
									}
								}else{
									$(".content").html('暂无数据');
									$(".content").css({"text-align":"center","line-height":"4rem","color":"#666","font-size":"0.5rem"});
								}
							}else {
									$(".content").html('暂无数据');
									$(".content").css({"text-align":"center","line-height":"4rem","color":"#666","font-size":"0.5rem"});
							} 
						},
						error:function(){
						} 
			}); 	
	});
}); 
</script>
</html>  